//
//  MSBuidingCorporationCell.m
//  觅尚
//
//  Created by No.8 on 2019/5/3.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSBuidingCorporationCell.h"

@implementation MSBuidingCorporationCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSBuidingCorporationCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSBuidingCorporationCell ID]];
    cell = [[MSBuidingCorporationCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSBuidingCorporationCell ID]];
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
- (void)setMember{
    
    /** 序号*/
    self.IDLabel = [[UILabel alloc] initWithFrame:CGRectMake(30 * px, 40 * px, 60 * px, 60 * px)];
    self.IDLabel.textColor = [UIColor whiteColor];
    self.IDLabel.text = @"";
    self.IDLabel.textAlignment = NSTextAlignmentCenter;
    self.IDLabel.font = [UIFont systemFontOfSize:SYRealValue(28  / 2)];
    [self addSubview:self.IDLabel];
    
    
    /** 序号*/
    self.NameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.IDLabel.frame) + 50 * px, self.IDLabel.y, ScreenWidth / 2, self.IDLabel.height)];
    self.NameLabel.textColor = [UIColor whiteColor];
    self.NameLabel.text = @"";
    self.NameLabel.textAlignment = NSTextAlignmentLeft;
    self.NameLabel.font = [UIFont systemFontOfSize:SYRealValue(28  / 2)];
    [self addSubview:self.NameLabel];
    
    
    /** 删除*/
    self.DeleteButton = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth - 210 * px, self.IDLabel.y - 10 * px, 180 * px, 80 * px)];
    [self.DeleteButton setTitle:@"删除" forState:UIControlStateNormal];
    self.DeleteButton.titleLabel.font = self.IDLabel.font;
    [self.DeleteButton  setTitleColor:WYCRGBColor(67, 139, 249) forState:UIControlStateNormal];
    [self.DeleteButton  addTarget:self action:@selector(DeleteButtonClick) forControlEvents:UIControlEventTouchUpInside];
    self.DeleteButton.layer.cornerRadius = 40 * px;//2.0是圆角的弧度，根据需求自己更改
    self.DeleteButton.layer.borderColor = WYCRGBColor(67, 139, 249).CGColor;//设置边框颜色
    self.DeleteButton.layer.borderWidth = 1.0f;//设置边框颜色
    [self addSubview:self.DeleteButton];
    
    
    /** 背景*/
    self.LinView = [[UIView alloc] initWithFrame:CGRectMake(0, 140 * px - 1, ScreenWidth, 1)];
    self.LinView.backgroundColor = BackViewColor;
    [self addSubview:self.LinView];
}
- (void)DeleteButtonClick{
    if (self.DeletegateButtonDelegate && [self.DeletegateButtonDelegate respondsToSelector:@selector(DelegateButtonClickSte_id:)]) {
        [self.DeletegateButtonDelegate DelegateButtonClickSte_id:self.BuidingModel.ste_id];
    }
    
}
- (void)setBuidingModel:(MSBuidingModel *)BuidingModel{
    _BuidingModel = BuidingModel;
    
    self.NameLabel.text = [NSString stringWithFormat:@"%@",BuidingModel.businessName];
    
    
}
+(NSString *)ID{
    return @"cell";
}
@end
